package com.efast.dmom.mgmt.openws;

import java.util.List;

import com.cafeauto.ws.Message;
import com.efast.cafe.commponent.es.webservice.annotation.CafeWSService;
import com.efast.cafe.commponent.es.webservice.base.WSAbstractAdapter;
import com.efast.cafe.commponent.es.webservice.utils.W3CElementUtil;
import com.efast.dmom.mgmt.bean.mes.testline.DischargeData;
import com.efast.dmom.mgmt.bean.mes.testline.DischargeDataBizContent;
import com.efast.dmom.mgmt.bean.mes.testline.DischargeInboundData;

@CafeWSService(bizCode = "Discharge_Test")
public class DischargeDataService extends WSAbstractAdapter {

	@Override
	public Message handleMessage(Message message) {

		logger.info("Received discharge data from: " + message.getBIZ_CODE());

		DischargeDataBizContent content = W3CElementUtil.elementUnmarshalToObj(message.getBIZ_CONTENT(),
				DischargeDataBizContent.class);
		DischargeInboundData inboundData = content.getDischargeInboudData();
		List<DischargeData> dataList = inboundData.getDischargeData();
		

		message.setBIZ_CONTENT(null);
		message.setMESSAGE_FROM("MES");
		message.setMESSAGE_TO("Discharge_Test");
		message.setRET_CODE("200");
		message.setRET_CODE_DESC("Successful");
		return message;
	}

}
